package com.tuananh.radnom.web.controller;
import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.oxm.Marshaller;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.tuananh.radnom.model.NetNode;
import com.tuananh.radnom.service.config.INetNodeService;

public class TestController extends AbstractController {
	INetNodeService netNodeService;
	Marshaller marshaller;
	public void setMarshaller(Marshaller marshaller) {
		this.marshaller = marshaller;
	}

	public void setNetNodeService(INetNodeService netNodeService) {
		this.netNodeService = netNodeService;
	}

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		// TODO Auto-generated method stub
		ModelAndView mav = new ModelAndView("home");
		ArrayList<NetNode> list = netNodeService.getAll();
		
		System.out.println(list.size());
		//netNodeService.remove(list.get(0).getName());
		mav.addObject("nodeList", list);
		
		return mav;
	}
}
